<template>
  <!--
    父子传值：
    ref
    v-model
    .sync
       子组件标签  :xxx="appXxx"  @update:xxx="appXxx=$event"
       子组件标签  :xxx.sync="appXxx"
       子组件内
              props:['xxx']
              this.$emit('update:xxx',实参值)
    props
     -->
  <el-dialog
    title="图片二维码"
    width="500px"
    :visible="isShow"
    @close="$emit('update:isShow', false)"
  >
    <div style="text-align: center">
      <canvas ref="qrcodeRef" />
    </div>
  </el-dialog>
</template>
<script>
import Qrcode from 'qrcode'
export default {
  props: {
    isShow: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {}
  },
  methods: {
    createCode(url) {
      this.$nextTick(() => {
        console.log('canvas', this.$refs.qrcodeRef)
        Qrcode.toCanvas(this.$refs.qrcodeRef, url, { width: 300 })
      })
    }
  }
}
</script>
<style></style>
